package com.waves.message.domain.enums;

/**
 * @author Eden
 * @date 2025/01/01 15:53
 **/

import com.waves.message.strategy.AbstractINoticeStrategy;
import com.waves.message.strategy.SystemInsideStrategy;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

@AllArgsConstructor
@Getter
public enum NoticeTypeEnums {

    INTERNAL_MESSAGE(0, "系统内部", SystemInsideStrategy.class),
    EMAIL(1, "邮件", null),
    DING_TALK(2, "钉钉", null),
    WECHAT_WORK(3, "企业微信", null);;

    private final Integer code;
    private final String desc;
    private final Class<? extends AbstractINoticeStrategy> noticeStrategy;

    public static Optional<NoticeTypeEnums> getEnumByCode(Integer code) {
        return Arrays.stream(NoticeTypeEnums.values())
                .filter(f -> Objects.equals(f.getCode(), code))
                .findFirst();
    }
}